<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <title>登录</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no,address=no" />
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <link rel="stylesheet" href="../css/common.css" />
    <link rel="stylesheet" href="../css/y_index.css" />
</head>
<style type="text/css">
.login {
    background: url(../img/login_bg.png) no-repeat;
    background-size: 100% 100%;
}
</style>

<body class="login">
    <article class="pt120 plr30">
        <section class="bw plr40 shadow">
            <div class="tac ptb60">
                <img src="../img/logo.png" style="width: 3.5rem;">
            </div>
            <div>
                <label class="plr20 bdb ptb30 flex_a">
                    <img src="../img/ico1.png" style="width: .3rem;">
                    <input type="number" class="ml20 flex1" placeholder="请输入手机号码" id="phone" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" maxlength="11" />
                </label>
                <label class="plr20 bdb ptb30 flex_a">
                    <img src="../img/ico2.png" style="width: .3rem;">
                    <input type="password" class="ml20 flex1" placeholder="请输入您的密码" id="psw">
                </label>
            </div>
            <div class="tae">
                <a href="ser_forgetPassword.html" class="lh80 color1 tdu">忘记密码?</a>
            </div>
            <div class="ptb40 flex_aj">
                <button class="bgc1 colw lh80 border-r6 plr110 btn_tap">登录</button>
            </div>
        </section>
    </article>
</body>

</html>
<script src="../js/jquery-1.8.3.min.js"></script>
<script src="../js/dlc.js"></script>
<script>
var onOff = 0;
if (getLocalData('msg')) {
    var msg = getLocalData('msg');
    $('#phone').val(msg.phone);
    $('#psw').val(msg.psw);
}
//登录
$('.btn_tap').click(function() {
    var phone = $('#phone').val();
    var psw = $('#psw').val();
    if (isNull(phone)) {
        dlctipbox.show('请输入手机号码');
    } else if (!checkMobileAndTel(phone)) {
        dlctipbox.show('手机号码有误');
    } else if (isNull(psw)) {
        dlctipbox.show('请输入您的密码');
    } else {
        if (onOff) return false;
        onOff = 1;
        dlctipbox.loading('请稍后');
        dlc_request('/api/agent/login', { phone: phone, password: psw, openId: user_token() }, function(res) {
            dlctipbox.clear();
            console.log(res);
            if (res.code == 1) {
                var msg = {};
                msg.phone = phone;
                msg.psw = psw;
                saveLocalData('msg', msg);
                saveLocalData('fd_id', res.data.agent.id);
                saveLocalData('fd_parentId', res.data.agent.parentId);
                saveLocalData('fd_parentName', res.data.agent.parentName);
                location.replace('./ser_index.html');
            } else {
                onOff = 0;
                dlctipbox.alert(res.msg);
            }
        })
    }

})
</script>